<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>模板语法</title>
  </head>
  <body>
    <script src="https://unpkg.com/vue@next"></script>

    <div id="root"></div>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            message: "hello world",
            event:"click",
            //name:"title1"  //动态参数
          };
        },

        methods:{
            //handleClick(e){
            //    e.preventDefault();
            //    alert("handleClick");
            //}

            handleClick(){
                alert("handleClick1");
            }
        },

        //template: `<div v-on:click="handleClick" v-bind:title="message">{{message}}</div>`,
        template: `<div 
                        @[event]="handleClick" 
                        :[name]="message">
                    {{message}}</div>`,
        //template: `<form action="https://www.baidu.com" @click.prevent="handleClick">
        //                <input type="submit" value="提交">    
        //        </form>`,
      });

      const vm = app.mount("#root");
    </script>
  </body>
</html>
